package com.czh.intelligentoj.judge;

import com.czh.intelligentoj.judge.strategy.DefaultJudgeStrategy;
import com.czh.intelligentoj.judge.strategy.JavaJudgeStrategy;
import com.czh.intelligentoj.judge.strategy.JudgeContext;
import com.czh.intelligentoj.judge.strategy.JudgeStrategy;
import com.czh.intelligentoj.judge.codesandbox.model.JudgeInfo;
import com.czh.intelligentoj.model.entity.QuestionSubmit;
import org.springframework.stereotype.Service;

/*
 * ClassName: JudgeManager
 * Package: com.czh.intelligentoj.judge.strategy
 * Description:
 * @Author: CZH
 * @Create: 2025
 */
@Service
public class JudgeManager {
    JudgeInfo doJudge(JudgeContext context){
        QuestionSubmit questionSubmit = context.getQuestionSubmit();
        String language = questionSubmit.getProLanguage();
        JudgeStrategy JudgeStrategy = new DefaultJudgeStrategy();
        if("JAVA".equals(language)){
            JudgeStrategy = new JavaJudgeStrategy();
        }
        return JudgeStrategy.doJudge(context);
    }
}
